# -*- encoding=utf8 -*-
__author__ = "Simon"

from airtest.core.api import *
from poco.drivers.unity3d import UnityPoco
poco = UnityPoco()

#从桌面启动pcr
def login():
    #获取分辨率
    x0,y0 = device().get_current_resolution()
    for i in range(5):
        if exists(Template(r"logo.png")):
            touch(Template(r"logo.png"))
            sleep(12)
            #获取旋转后的分辨率
            global x,y
            x,y=device().get_current_resolution()
            wait(Template(r"menu.png"),interval=3)
            touch([0.5*x,0.88*y])
            sleep(10)
            touch([0.95*x,0.07*y],times=2)
            sleep(6)
            touch([0.95*x,0.07*y],times=2)
            sleep(4)
            touch([0.95*x,0.07*y],times=2)
            sleep(10)
            wait(Template(r"../close.png"),interval=3)
            touch([0.5*x,0.88*y])
            break
        else:
            swipe((0.9*x0,0.5*y0),(0.1*x0,0.5*y0),duration = 0.3)
            sleep(1)